<template>
	<div class="addAreaModel ">
		<!-- 基础信息表单 -->
		<LabelForm
			:formLabel="formLabel"
			ref="form"
		/>
		<div class="btn">
			<el-button
				@click="back()"
				size="medium"
			>取消</el-button>
			<el-button
				@click="handleSubmit"
				size="medium"
				type="primary"
			>新增</el-button>
		</div>
	</div>
</template>
<script>
	import LabelForm from '@/components/common/Form/labelForm'
	import { listFormLabel } from './data'
	import Api from './api'
	export default {
		components: {
			LabelForm
		},
		props: {
			value: Array
		},
		data() {
			return {
				formLabel: listFormLabel,
				// 表单数据
				form: {}
			}
		},
		computed: {},
		created() {},
		methods: {
			// 提交表单
			handleSubmit: function () {
				this.$refs.form.validate(
					(form, valid) => {
						Api.addOrUpdate(form)
							.then(res => {
								this.$message.success('新增成功')
							})
							.catch(e => {})
					},
					() => {}
				)
			}
		}
	}
</script>
<style lang="scss" scoped>
	.addAreaModel {
		position: fixed;
		top: 300px;
		z-index: 20;
	}
</style>
